<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ page import="java.util.*,
						com.ophelisis.common.util.*,
						com.ophelisis.common.consts.*,
						com.ophelisis.actions.system.*"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>

<script>
$(document).ready(function() {
	$("#imageForm").find("input[type=text]").attr("disabled","disabled");
	$("#imageForm").find("input[type=password]").attr("disabled","disabled");
	$("#imageForm").find("input[type=radio]").attr("disabled","disabled");
	$("#imageForm").find("input[type=file]").hide();
	$("#imageForm").find("select").attr("disabled","disabled");
	$("#imageForm").find("textarea").attr("disabled","disabled");
	$(".btnModify").show();
	$(".btnSave").hide();
	
	if (checkUserAuth() < 2) {
		$(".btnModify, .btnSave").hide();
	}
});
</script>
<%@ include file="/WEB-INF/jsp/common/resultMessageLocal.jsp"%>
<div id="formlist1" class="noborder">
	<input type="hidden" id="loadCheck" name="loadCheck" value="OK" />
	<form id="imageForm" name="imageForm" method="post" enctype="multipart/form-data">
    	<input type="hidden" id="isNew" name="isNew" value="N" />
    	<input type="hidden" id="isFileCheck" name="isFileCheck" value="" />
		<table class="viewstyle1">
			<c:choose>
				<c:when test="${menuImageList != '' && !empty menuImageList}">
					<c:forEach var="list" items="${menuImageList}" varStatus="status">
				    	<input type="hidden" id="imageId" name="imageId" value="${list.imageId}" />
				    	<input type="hidden" id="menuGroupId" name="menuGroupId" value="${list.menuGroupId}" />
						<colgroup>
							<col width="130" />
							<col width="" />
						</colgroup>
						<tr>
							<th><img src="images/btn/btn_form_add.gif" class="pdt3 clickable btnSave" onclick="javascript:pmModule.setFileAdd(this);" /></th>
							<td><span class="red pdl5">이미지 크기는 1MB 이하를 권장합니다.(너무 크면 로딩시간이 길어집니다.)</span></td>
						</tr>
						<c:set var="fileOldArray" value="${fn:split(list.imageFileOld, '|')}" />
						<c:set var="fileNewArray" value="${fn:split(list.imageFileNew, '|')}" />
						<c:set var="fileWidthArray" value="${fn:split(list.imageFileWidth, '|')}" />
						<c:set var="fileHeightArray" value="${fn:split(list.imageFileHeight, '|')}" />
						<c:set var="fileThumbnailArray" value="${fn:split(list.imageFileThumbnail, '|')}" />
						<c:if test="${fn:length(fileOldArray) > 0}">
							<c:forEach var="i" begin="0" end="${fn:length(fileOldArray) - 1}" step="1">
								<tr>
									<th>첨부 파일 #${(i + 1)}</th>
						            <td>
						            <input type="file" id="imageFile${(i + 1)}" name="imageFile${(i + 1)}" class="input_text" />
						            <input type="hidden" id="imageFileOld${(i + 1)}" name="imageFileOld${(i + 1)}" value="${fileOldArray[i]}" />
						            <input type="hidden" id="imageFileNew${(i + 1)}" name="imageFileNew${(i + 1)}" value="${fileNewArray[i]}" />
						            <div class="fileDiv">
						            	<img src="menuImageFileDownload.action?fileName=${fileThumbnailArray[i]}" /><BR/>
										<a href="menuImageFileDownload.action?fileName=${fileNewArray[i]}" target="iframeProcess">${fileOldArray[i]}</a>
										<img src="images/btn/search03.png" class="clickable width_15p height_15p searchImage" onclick="javascript:pmModule.getViewImage('${fileNewArray[i]}','${fileWidthArray[i]}','${fileHeightArray[i]}');" />
									</div>
						            </td>
								</tr>
							</c:forEach>
						</c:if>
					</c:forEach>
				</c:when>
			</c:choose>
		</table>
	</form>
	<div id="lowbtn">
		<a href="javascript:pmModule.setDelete();" id="btnDelete" class="btnModify"><img src="images/btn/btn_delete01.gif" /></a> 
		<a href="javascript:pmModule.setModify();" class="btnModify"><img src="images/btn/btn_modify01.gif" /></a> 
		
		<a href="javascript:pmModule.reset('reset');" class="btnSave"><img src="images/btn/btn_cancel01.gif" /></a>
		<a href="javascript:pmModule.save();" class="btnSave"><img src="images/btn/btn_save01.gif" /></a>  
	</div>
</div>
